import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-10
 * Time: 10:22
 */
/*class Dog{
    public int age;
    public String name;

    public void print(){
        System.out.println(name + " hello");
    }
}*/
class Dog{//class + 类名
//    字段/属性/成员变量
    public int age;
    public String name;

//    行为/成员方法
    public void print(){
        System.out.println(name + "吃狗粮！");
    }

    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.age = 0;
    }
}

public class TestDemo {
    public static void main(String[] args) {

    }
    public static void main1(String[] args) {
        //定义及初始化一个数组
//        1.
        int[][] array1 = new int[][]{{1,2,3},{4,5,6},{7,8,9}};
        for (int i = 0; i < array1.length; i++) {
            for (int j = 0; j < array1[i].length; j++) {
                System.out.print(array1[i][j] + " ");
            }
            System.out.println();
        }
        System.out.println("================");

//        2.
        int[][] array2 = {{1,2,3},{4,5,6},{7,8,9}};
        for (int[] tmp:array2) {
            for (int x:tmp) {
                System.out.print(x + " ");
            }
            System.out.println();
        }
        System.out.println("================");
//        3.
        int[][] array3 = new int[3][];
        array3[0] = new int[]{1,2,3};
        array3[1] = new int[]{4,5,6};
        array3[2] = new int[]{7,8,9};
        System.out.println(Arrays.deepToString(array3));
        System.out.println("================");
//        4.不规则二维数组
        int[][] array4 = new int[2][];//列可以省略，行不可以省略
//        System.out.println(array4[0]);
//        System.out.println(array4[1]);
        array4[0] = new int[3];
        array4[1] = new int[5];
        System.out.println(Arrays.deepToString(array4));
    }
}
